﻿namespace SLClient.CustomerControls
{
    using SLClient.Infrastructure;
    using System;
    using System.Linq.Expressions;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Windows;
    using System.Windows.Input;

    public class NotificationViewModel : ViewModelBase
    {
        private Visibility _canVisibity;
        private ShowMsg _showMsg;

        public NotificationViewModel(ShowMsg showMsg)
        {
            this._showMsg = showMsg;
            this._canVisibity = 0;
            this.CommandInit();
        }

        public void Close()
        {
            this.CanVisibity = Visibility.Collapsed;
        }

        public void CommandInit()
        {
            RelayCommand command = new RelayCommand(new Action(this.Close)) {
                IsEnabled = true
            };
            this.CloseCommand = command;
        }

        public Visibility CanVisibity
        {
            get
            {
                return this._canVisibity;
            }
            set
            {
                this._canVisibity = value;
                base.Notify<Visibility>(() => this.CanVisibity);
                //base.Notify<Visibility>(System.Linq.Expressions.Expression.Lambda<Func<Visibility>>(System.Linq.Expressions.Expression.Property(System.Linq.Expressions.Expression.Constant(this, typeof(NotificationViewModel)), (MethodInfo)(NotificationViewModel.get_CanVisibity)), new ParameterExpression[0]));
            }
        }

        public ICommand CloseCommand { get; set; }

        public ShowMsg CurrentMsg
        {
            get
            {
                return this._showMsg;
            }
            set
            {
                this._showMsg = value;
                base.Notify<ShowMsg>(() => this.CurrentMsg);
                //base.Notify<ShowMsg>(System.Linq.Expressions.Expression.Lambda<Func<ShowMsg>>(System.Linq.Expressions.Expression.Property(System.Linq.Expressions.Expression.Constant(this, typeof(NotificationViewModel)), (MethodInfo)(NotificationViewModel.get_CurrentMsg)), new ParameterExpression[0]));
            }
        }
    }
}

